<?php namespace WoXuanWang\Dashboard\Repositories;

use WoXuanWang\Settings\Repositories\SettingsRepository;
use WoXuanWang\Upload\Models\Upload;

class DashboardRepository
{
    /**
     * @param $position [1, 9]
     * @param $uploadId
     */
    public function setImageAtPosition($position, $uploadId)
    {
//        $upload = Upload::find($uploadId);
        $settingContent = [
            'type'   => 'upload',
            'upload' => $uploadId,
        ];
        $settingsRepo = app(SettingsRepository::class);
        $settingKey = $settingsRepo->getDashboardSettingKey();
        $settingsRepo->setDashboardGrid($position, $settingContent, $settingKey);
    }
}
